<?php
include_once SERVER_ROOT.'/model/model.php';
class Model_mpost extends Model {
    public function getMyPost($uid,$start,$limit) {
        if(!$uid) return false;
        $d_dpost = new Data_dpost();
        $list = $d_dpost->getMyPost($uid,$start,$limit);
        if($list) {
            $pattern = "|(^https?://[a-zA-Z0-9./?]+[^\s]*)$|i";
            foreach($list as &$val) {
                $val['info'] = preg_replace($pattern ,"<a rel=\"nofloow\" target=\"_blank\" href=\"$1\">$1</a>",$val['info']);
            }
        }
        return $list;
    }
    public function getMyPostTotal($uid) {
        if(!$uid) return 0;
        $d_dpost = new Data_dpost();
        $total = $d_dpost->getMyPostTotal($uid);
        return $total;
    }
    public function addPost($uid,$title,$info) {
        $d_dpost = new Data_dpost();
        return $d_dpost->addPost($uid,$title,$info);
    }
}

?>
